package com.resou.reader.test;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.resou.reader.R;
import com.resou.reader.api.entry.BookContentBean;
import com.resou.reader.api.entry.BookDetailBean;
import com.resou.reader.api.entry.ChapterItemBean;
import com.resou.reader.api.entry.ShareTimeBean;
import com.resou.reader.base.v.BaseActivity;
import com.resou.reader.reader.OnAdViewLoadListener;
import com.resou.reader.reader.manager.PageFactory;
import com.resou.reader.reader.p.ReaderPresenter;
import com.resou.reader.reader.v.IReaderView;
import com.resou.reader.reader.view.NativeTTAdView;
import com.resou.reader.view.Loading;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SignInTestActivity extends AppCompatActivity {


    @BindView(R.id.btnRefresh)
    Button btnRefresh;
    Loading loading = new Loading();

    public static void start(Context context) {
        Intent starter = new Intent(context, SignInTestActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_in_2);
        ButterKnife.bind(this);

        findViewById(R.id.btnRefresh)
                .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Loading.getInstance().setView(2);
                        Loading.getInstance().show(getSupportFragmentManager());
                        new CountDownTimer(3000, 1000) {
                            @Override
                            public void onTick(long millisUntilFinished) {

                            }

                            @Override
                            public void onFinish() {
                                loading.dismiss();
                                Loading.getInstance().dismiss();
                            }
                        }.start();
                    }
                });
        findViewById(R.id.btnRefresh2)
                .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (getSupportFragmentManager().getFragments() != null
                                && getSupportFragmentManager().getFragments().size() > 0) {
                            getSupportFragmentManager().getFragments().clear();
                        }
                    }
                });
    }
}